#ifndef _DDRAWABLE_H
#define _DDRAWABLE_H

//==============================================================================
//
//            DDrawable - the protocol for classes that can draw
//
//               Copyright (C) 2005  Dick van Oudheusden
//  
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//==============================================================================
// 
//  $Date: 2008-07-19 12:28:59 $ $Revision: 1.6 $
//
//==============================================================================

#include "ofc/DTextWritable.h"


#define DDW_AREA_OPEN      (0) // Area is open
#define DDW_AREA_FILLED    (1) // Area is filled

#define DDW_LINE_SOLID     (0) // Line is solid
#define DDW_LINE_DASHED    (1) // Line is dashed
#define DDW_LINE_DOTTED    (2) // Line is dotted

#define DDW_BORDER_SOLID   (0) // Border is solid
#define DDW_BORDER_DASHED  (1) // Border is dashed
#define DDW_BORDER_DOTTED  (2) // Border is dotted
#define DDW_BORDER_NONE    (3) // No border
#define DDW_BORDER_DOUBLE  (4) // Border is double lines
#define DDW_BORDER_GROOVE  (5) // Border has a groove
#define DDW_BORDER_RIDGE   (6) // Border is ..
#define DDW_BORDER_INSET   (7) // Border is ..
#define DDW_BORDER_OUTSET  (8) // Border is ..

#define DDW_CURSOR_OFF     (0) // Disable the cursor
#define DDW_CURSOR_ON      (1) // Enable the cursor

#define DDW_POINTER_OFF    (0) // Disable the mouse pointer
#define DDW_POINTER_ON     (1) // Enable the mouse pointer

//
// The DDrawable protocol specifies methods that should be implemented by
// classes that draw on an area.
//

@protocol DDrawable <DTextWritable>

//
// Set the visibility of the cursor
// 
// @param state   the cursor state (DDW_CURSOR..)
// 
// @return the previous state of the cursor
// 
- (int) cursor :(int) state;

//
// Set the visibility of the mouse pointer
// 
// @param state   the pointer state (DDW_POINTER..)
// 
// @return the previous state of the pointer
// 
- (int) pointer :(int) state;

//
// Clear the drawable
// 
// @return success
// 
- (BOOL) clear;

//
// Draw a (horizontal) line on the drawable
//
// @param startX    the x position for the start of the line
// @param endX      the x position for the end of the line
// @param startY    the y position for the line
// @param lineType  the type of the line DDW_LINE_...
//
// @return success
//
- (BOOL) drawHLine :(unsigned) startX : (unsigned) endX :(unsigned) startY :(int) lineType;

//
// Draw a horizontal line with the previous line width and type settings
//
// @param startX    the x position for the start of the line
// @param endX      the x position for the end of the line
// @param startY    the y position for the line
//
// @return success
//
- (BOOL) drawHLine :(unsigned) startX : (unsigned) endX :(unsigned) startY;

//
// Draw a (horizontal) line on the drawable starting from the current position and
// with the previous line width and type settings
//
// @param endX      the x position for the end of the line
//
// @return success
//
- (BOOL) drawHLine : (unsigned) endX ;

//
// Draw a vertical line on the screen
// 
// @param startX      the x position for the line
// @param startY      the y position for the line
// @param endY        the y position for the end of the line
// @param lineType    the type of the line (DDW_LINE_...)
// @param lineWidth   the width of the line (>0)
// 
// @return success
// 
- (BOOL) drawVLine :(unsigned) startX :(unsigned) startY :(unsigned) endY :(int) lineType;

//
// Draw a vertical line with the current line type and width settings
// 
// @param startX      the x position for the line
// @param startY      the y position for the line
// @param endY        the y position for the end of the line
// 
// @return success
// 
- (BOOL) drawVLine :(unsigned) startX :(unsigned) startY :(unsigned) endY;

//
// Draw a (vertical) line on the drawable starting from the current position and
// with the current line width and type settings
//
// @param endY      the y position for the end of the line
//
// @return success
//
- (BOOL) drawVLine :(unsigned) endY;

//
// Draw a line on the screen
//
// @param startX      the x position for the start of the line 
// @param endX        the x position for the end of the line
// @param startY      the y position for the start of the line
// @param endY        the y position for the end of the line
// @param lineType    the type of the line (DDW_LINE_...)
// @param lineWidth   the width of the line (>0)
// 
// @return success
// 
- (BOOL) drawLine :(unsigned) startX :(unsigned) endX :(unsigned) startY :(unsigned) endY :(int) lineType;
  
//
// Draw a line with the current line type and width settings
//
// @param startX  the x position for the start of the line 
// @param endX    the x position for the end of the line
// @param startY  the y position for the start of the line
// @param endY    the y position for the end of the line
// 
// @return success
// 
- (BOOL) drawLine :(unsigned) startX :(unsigned) endX :(unsigned) startY :(unsigned) endY;

//
// Draw a line on the drawable starting from the current position and
// with the current line width and type settings
//
// @param endX      the x-position for the end of the line
// @param endY      the y-position for the end of the line
//
// @return success
//
- (BOOL) drawLine :(unsigned) endX :(unsigned) endY;


@end

#endif

